set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

" -----------------------------------------------------------
" ADDED BY ANIL, my own settings, that I like.
" indent
:map <F7> <ESC> ggv<S-g>=
set autoindent          " always set autoindenting on
set smartindent         " smartindent! :)
set nobackup " nobackup

se guifont=Consolas:h10:cANSI
se nu
" date = strftime("%d %b %y")
ab TODO AnilW:r!cmd /c date /t <cr><esc>kJATODO
ab FIXME AnilW:r!cmd /c date /t <cr><esc>kJAFIXME
" ab TODO AnilW ^O:r! date +\%d-\%b-\%y^[kJA TODO
" ab FIXME AnilW ^O:r! date +\%d-\%b-\%y^[kJA FIXME 
" date = echo strftime("%d %b %y")

" key mapping
" tab navigation
:map <F3> :tabprevious <cr>
:map <F4> :tabnext <cr>
":map <C-Tab> :tabnext <cr>
:map <F2> :tabnew <cr>
:map <F2> :tabnew <cr>
" :map <F8> :NERDTreeToggle <cr>

" others
:map <F5> : set nu! <CR>
:map <F6> : set hlsearch! <CR>
:map <F9> : shell <CR>

func CheckSwap()
	swapname
	if v:statusmsg =~ '\.sw[^p]$'
		set ro
	endif
endfunc

if &swf
	set shm+=A
	au BufReadPre * call CheckSwap()
endif 

" -----------------------------------------------------------

set diffexpr=MyDiff()
function MyDiff()
	let opt = '-a --binary '
	if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
	if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
	let arg1 = v:fname_in
	if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
	let arg2 = v:fname_new
	if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
	let arg3 = v:fname_out
	if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
	let eq = ''
	if $VIMRUNTIME =~ ' '
		if &sh =~ '\<cmd'
			let cmd = '""' . $VIMRUNTIME . '\diff"'
			let eq = '"'
		else
			let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
		endif
	else
		let cmd = $VIMRUNTIME . '\diff'
	endif
	silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction

